package com.excesys.exsecs.energy.service;

import cn.hutool.core.lang.tree.Tree;
import com.alibaba.fastjson.JSONObject;
import com.baomidou.mybatisplus.extension.service.IService;
import com.excesys.exsecs.energy.entity.DevSubitemMap;
import com.excesys.exsecs.energy.entity.DimSubitem;

import java.util.List;
import java.util.Map;

public interface DimSubitemService extends IService<DimSubitem> {

    List<Tree<Long>> queryTree(DimSubitem dimSubitem);

    DimSubitem getSubitemById(Long id);

    /**
     * 保存或更新支路与关联表计的关系
     */
    boolean saveDevSubitemMap(DimSubitem dimSubitem);

    /**
     * 删除部门及关联表计关系和分区关系
     */
    boolean removeSubitemBatchByIds(List<Long> ids);

    List<DevSubitemMap> getMetersById(DimSubitem dimSubitem);

    //桑基图
    JSONObject powerSubitemSanchitou(String id, String startDate, String endDate);

    JSONObject powerSubitemBingtu(String startDate, String endDate);

    /*
     * 能耗报表
     * */
    List<Map<String, Object>> getSubitemReportPage(String ids, String date);

    /*
     * 能耗对比
     * */
    JSONObject powerSubitemContrast(String ids, String startDate, String endDate);

    /*
     * 能耗排序
     * */
    List<Map<String, Object>> subitemSort(String ids, String startDate, String endDate, String order);


    /*
     *分项能耗占比
     */
    JSONObject subitemRatio(String startDate, String endDate, String compareType, String energyType);
}